#include<stdio.h>
#include<unistd.h>

int gavl = 100;
int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        while(1)
        {
        printf("子:gavl：%d, &gavl: %p, pid: %d, ppid: %d\n", gavl, &gavl, getpid(), getppid());
        sleep(1);
        gavl++;
        }
    }
    else
    {
        while(1)
        {
        printf("父:gavl：%d, &gavl: %p, pid: %d, ppid: %d\n", gavl, &gavl, getpid(), getppid());
        sleep(1);
        }
    }

    return 0;
}
























































































